<template>
  <div class="mod-api__userdata">
    <el-form :inline="true" :model="state.dataForm" @keyup.enter="state.getDataList()">
      <!-- <el-form-item>
        <el-button type="primary"
          @click="addOrUpdateHandle()">新增</el-button>
      </el-form-item> -->
      <el-form-item>
        <el-button  type="danger"
          @click="state.deleteHandle()">删除</el-button>
      </el-form-item>
    </el-form>
    <el-table v-loading="state.dataListLoading" :data="state.dataList" border
      @selection-change="state.dataListSelectionChangeHandle" style="width: 100%">
      <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
      <el-table-column prop="contentTypeName" label="反馈类型 " header-align="center" align="center"></el-table-column>
      <!-- <el-table-column prop="contentType" label="反馈类型" header-align="center" align="center"></el-table-column> -->

      <el-table-column prop="content" label="内容 " header-align="center" align="center"></el-table-column>
      <!-- <el-table-column prop="imgId" label="资料id" header-align="center" align="center"></el-table-column> -->
   <el-table-column prop="imgUrl" label="相关截图" header-align="center" align="center" class-name	="dsfdspr">
        <template #default="scope">
          <el-image
      style="width: 40px; height: 40px"
      :src="xcfdtrt(scope.row.imgUrl)"
      :zoom-rate="1.2"
      :max-scale="7"
      :min-scale="0.2"
      :preview-src-list="xdfdtrt(scope.row.imgUrl)"
      :initial-index="4"
      fit="cover"
    />
        </template>
      </el-table-column> 
      <el-table-column prop="companyName" label="企业名称" header-align="center" align="center"></el-table-column>
      <!-- <el-table-column prop="companyId" label="企业名称" header-align="center" align="center"></el-table-column> -->
      <el-table-column prop="realName" label="真实姓名" header-align="center" align="center"></el-table-column>
      <el-table-column prop="userPhone" label="联系电话" header-align="center" align="center"></el-table-column>
      <!-- 1 待审核 2审核通过 3审核不通过 -->
      <el-table-column prop="isPass" label="审核状态" header-align="center" align="center">
        <template #default="scope">
{{ kmxzcf(scope.row.isPass) }}
          </template>
      </el-table-column>
      <!-- <el-table-column prop="passContent" label="审核不通过内容" header-align="center" align="center"></el-table-column> -->
      <!-- <el-table-column prop="createTime" label="创建时间" header-align="center" align="center"></el-table-column>
              <el-table-column prop="updateTime" label="更新时间" header-align="center" align="center"></el-table-column> -->

      <!-- <el-table-column prop="companyName" label="归属企业" header-align="center" align="center"></el-table-column> -->

      <el-table-column label="操作" fixed="right" header-align="center" align="center" width="150">
        <template v-slot="scope">
      <el-button  type="primary" link @click="addOrUpdateHandle(scope.row.id)">点击处理</el-button> 
          <el-button type="primary" link @click="state.deleteHandle(scope.row.id)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination :current-page="state.page" :page-sizes="[10, 20, 50, 100]" :page-size="state.limit"
      :total="state.total" layout="total, sizes, prev, pager, next, jumper" @size-change="state.pageSizeChangeHandle"
      @current-change="state.pageCurrentChangeHandle"> </el-pagination>
    <!-- 弹窗, 新增 / 修改 -->
    <add-or-update ref="addOrUpdateRef" @refreshDataList="state.getDataList">确定</add-or-update>
  </div>
</template>

<script lang="ts" setup>
import useView from "@/hooks/useView";
import { reactive, ref, toRefs } from "vue";
import AddOrUpdate from "./yijianfankui-add-or-update.vue";
import {kmxzcf} from "@/utils/utils"

const view = reactive({
  deleteIsBatch: true,
  getDataListURL: "/api/userdata/page?type=5",
  getDataListIsPage: true,
  exportURL: "/api/userdata/export",
  deleteURL: "/api/userdata"
});

const state = reactive({ ...useView(view), ...toRefs(view) });

const addOrUpdateRef = ref();
const addOrUpdateHandle = (id?: number) => {
  addOrUpdateRef.value.init(id);
};
const xdfdtrt = (data)=>{
 try{
  return data.split(",")
 }catch(e){

 }
}
const xcfdtrt = (data)=>{
 try{
  return data.split(",")[0]
 }catch(e){

 }
}
</script>
